<?php

namespace App\Console\Commands;

use App\Models\CustomerInfo;
use Illuminate\Console\Command;
use App\Models\Referee;
use App\Jobs\GivePointToRefereeForClue;

class ReissueRefereePoint extends Command
{
    protected $signature = 'dfjk:reissue-referee-point';
    protected $description = '补发推荐官留资积分';

    public function handle(Referee $referee)
    {
        $customerInfos = CustomerInfo::whereNotNull('referee_id')->where('clue_point', '=', 0)->get();
        foreach ($customerInfos as $customerInfo) {
            dispatch(new GivePointToRefereeForClue($customerInfo));
        }
        $this->info("补发成功");
    }
}
